<?php

namespace app\nideshop\validate;

use think\Validate;

class CartValidate extends Validate
{	
	/**
	 * 验证规则
	 * @var [type]
	 */
	protected $rule = [
		'goodsId|商品id' => 'require|number',
		'productId|产品id' => 'require|number',
		'number|数量' => 'require|integer',
		'id|购物车商品id' => 'require|number',
		'productIds|商品id' => 'require',
		'isChecked|是否选中' => 'require|integer'
	];

	/**
	 * 添加验证场景
	 * @Author   fanzhongxing
	 * @DateTime 2020-05-24T09:23:47+0800
	 * @return   [type]                   [description]
	 */
	public function sceneAdd()
	{
		return $this->only(['goodsId', 'productId', 'number']);
	}

	/**
	 * 修改验证场景
	 * @Author   fanzhongxing
	 * @DateTime 2020-05-24T09:52:26+0800
	 * @return   [type]                   [description]
	 */
	public function sceneUpdate()
	{
		return $this->only(['goodsId', 'productId', 'number', 'id']);
	}

	/**
	 * 删除验证场景
	 * @Author   fanzhongxing
	 * @DateTime 2020-05-24T22:10:37+0800
	 * @return   [type]                   [description]
	 */
	public function sceneDel()
	{
		return $this->only(['productIds']);
	}

	/**
	 * 是否选中验证场景
	 * @Author   fanzhongxing
	 * @DateTime 2020-05-24T22:11:12+0800
	 * @return   [type]                   [description]
	 */
	public function sceneCheck()
	{
		return $this->only(['productIds', 'isChecked']);
	}
}